<template>
<div id="dz_find" class="page in " data-title="">    
   <div class="container" style="top:1.8rem;">       
      
      <div class="find-header flex-wrap-around">
        <div :class="{on:view_layer.notice}"  @click="init">公告</div>
        <!-- <div :class="{on:view_layer.model}"  @click="nfmodel">销售排行</div> -->
        <div :class="{on:view_layer.model}"  @click="nfmodel">热门机型</div>
        <div :class="{on:view_layer.trade}"  @click="nftrade">行业热门</div>
      </div>
     
     <div class="find-container pa">
        
        <!-- 公告 -->
        <div class="notice-wrap" v-show="view_layer.notice">
            
            <div class="notice-ul">
              
              <div class="notice-li"  v-for="(item, index) in noticelist" :key="index" :data-noticeid="item.notice_id" @click="gotodetail">
                <div class="notice-title">{{item.title}}</div>
                <div class="notice-content">
                   {{item.shortdesc}}
                </div>
                <div class="notice-other flex-wrap-start">
                  <span>{{item.at_time}}</span>
                  <span>{{item.name}}</span> 
                </div>
              </div>

 
            </div>

        </div>

        <!-- 销售排行  计划去掉 -->
        <!-- <div class="sell-wrap" v-show="view_layer.sell">
          
          <div class="sell-bg icon">
            <span>2020年3月</span>
          </div>
          <div class="sell-ul pa">
            <div class="sell-li flex-wrap-around">
              <div class="num">NO.1</div>
              <div class="device"><span class="xh">机型1</span><span class="xl">HF系列</span></div>
              <div class="amount">数量：25</div>
            </div>
            <div class="sell-li flex-wrap-around">
              <div class="num">NO.1</div>
              <div class="device"><span class="xh">机型1</span><span class="xl">HF系列</span></div>
              <div class="amount">数量：25</div>
            </div>
            <div class="sell-li flex-wrap-around">
              <div class="num">NO.1</div>
              <div class="device"><span class="xh">机型1</span><span class="xl">HF系列</span></div>
              <div class="amount">数量：25</div>
            </div>
          </div>

        </div> -->
        
        <!-- 热门机型 -->
        <div class="model-wrap" v-show="view_layer.model" >          
          <div class="model-bg icon"></div>
          <div class="sell-ul pa model-ul">
            <div class="sell-li flex-wrap-around" v-for="(item, index) in modellist" :key="index">
              <div class="num">{{index+1}}</div>
              <div class="device"><span class="xh">{{item.series}}</span><span class="xl">{{item.mac_type}}</span></div>
              <div class="amount">数量：{{item.number}}</div>
            </div>
          </div>
        </div>

        <!-- 行业热门 -->
        <div class="trade-wrap" v-show="view_layer.trade">
          
          <div class="trade-ul">            
            <div class="trade-li" v-for="(item, index) in tradelist" :key="index">
              <div class="icon trade1 trade-title" :data-indid="item.ind_id">{{item.industry}}</div>
              <div class="trade-content">
                <div class="flex-wrap-between" v-for="(item2, index2) in item.list" :key="index2">
                  <span>{{index2+1}}.{{item2.series}} {{item2.mac_type}}</span><span>数量:{{item2.total}}</span>
                </div>               
              </div>
            </div>
          </div>

        </div>
     </div>

       <!-- 底部菜单 -->
      <my-header  :menuitem="2"></my-header>
   </div>   
</div>    
</template>

<script>
var mySelf;  
export default {
    data() {
      return {
        view_layer:{
            'notice': 0,            
            'model':0, 
            'trade':0
        },
        noticelist:[],
        modellist:[],
        tradelist:[],
        param:[],
      }
    },
    beforeCreate() {
			this.$myUtils.isLoginGotoPage();	
		},
    methods: {
      init:function() {
        this.view_layer_close();
        this.view_layer.notice= 1;
        uni.showToast({
							title: '正在加载数据',
							icon:'loading',
							duration:1000
         });
        this.$myUtils.myRequest({
					url: '/Announcement/noticeList',
				}).then(res => {					 
					mySelf.noticelist = res.data.data.list; 
					
        })	
 
      },
       onLoad(param) {           
            this.param = param;
        },
      nfmodel:function() {
          this.view_layer_close();
          this.view_layer.model=true;
          uni.showToast({
							title: '正在加载数据',
							icon:'loading',
							duration:1000
                        });

          this.$myUtils.myRequest({
            url: '/Seriesmodel/hotModelList',
          }).then(res => {					 
            mySelf.modellist = res.data.req; 
        
            if (!mySelf.modellist) {
              return uni.showToast({
                  title: '未找到符合条件的数据',
                  icon:'loading',
                  duration:1000
                });
            }
             
          })	
          
      },
      nftrade:function() {
          this.view_layer_close();
          this.view_layer.trade=true;
          uni.showToast({
                title: '正在加载数据',
                icon:'loading',
                duration:1000
                          });

          this.$myUtils.myRequest({
            url: '/Industry/hotInduList',
          }).then(res => {		
 
            mySelf.tradelist = res.data.data;
            if (mySelf.tradelist=='') {
                return uni.showToast({
                title: '未找到符合条件的数据',
                icon:'loading',
                duration:1000
                          });
            } 
            
          })	
          

      },
      view_layer_close() {
          this.view_layer.notice= false;
          this.view_layer.model=false;
          this.view_layer.trade=false;

      },
      gotodetail(ev) {
 
        let id = ev.currentTarget.dataset.noticeid;
        let url = "/pages/information/detail?id="+id; 
        uni.navigateTo({
                url: url
            });
      }

      
    },
    mounted() {
      mySelf = this;
      this.init();
    },
}
</script>